﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ra2_jifenban
{
    public partial class Config
    {
        #region CoreConfig
        public string PlayerA
        {
            get
            {
                try
                {
                    return getCoreConfig("PlayerA");
                }
                catch
                {
                    return "A";
                }
            }
            set
            {
                writeCoreConfig("PlayerA", value);
            }
        }
        public string PlayerB
        {
            get
            {
                try
                {
                    return getCoreConfig("PlayerB");
                }
                catch
                {
                    return "B";
                }
            }
            set
            {
                writeCoreConfig("PlayerB", value);
            }
        }

        public int ScoreA
        {
            get
            {
                try
                {
                    return int.Parse(getCoreConfig("ScoreA"));
                }
                catch
                {
                    return 0;
                }
            }
            set
            {
                writeCoreConfig("ScoreA", value.ToString());
            }
        }
        public int ScoreB
        {
            get
            {
                try
                {
                    return int.Parse(getCoreConfig("ScoreB"));
                }
                catch
                {
                    return 0;
                }
            }
            set
            {
                writeCoreConfig("ScoreB", value.ToString());
            }
        }

        public string TextEditor
        {
            get
            {
                try
                {
                    return getCoreConfig("TextEditor");
                }
                catch
                {
                    return "notepad.exe";
                }
            }
            set
            {
                writeCoreConfig("TextEditor", value);
            }
        }
        #endregion

        #region UiConfig
        public int LocationX
        {
            get
            {
                try
                {
                    return int.Parse(getUiConfig("LocationX"));
                }
                catch
                {
                    return 0;
                }
            }
            set
            {
                writeUiConfig("LocationX", value.ToString());
            }
        }
        public int LocationY
        {
            get
            {
                try
                {
                    return int.Parse(getUiConfig("LocationY"));
                }
                catch
                {
                    return 0;
                }
            }
            set
            {
                writeUiConfig("LocationY", value.ToString());
            }
        }
        public int Width
        {
            get
            {
                try
                {
                    return int.Parse(getUiConfig("Width"));
                }
                catch
                {
                    return 500;
                }
            }
            set
            {
                writeUiConfig("Width", value.ToString());
            }
        }
        public int Heigth
        {
            get
            {
                try
                {
                    return int.Parse(getUiConfig("Heigth"));
                }
                catch
                {
                    return 150;
                }
            }
            set
            {
                writeUiConfig("Heigth", value.ToString());
            }
        }

        public string BackColor
        {
            get
            {
                try
                {
                    return getUiConfig("BackColor");
                }
                catch
                {
                    return "0,0,0";
                }
            }
            set
            {
                writeUiConfig("BackColor", value);
            }
        }
        public string FontColor
        {
            get
            {
                try
                {
                    return getUiConfig("FontColor");
                }
                catch
                {
                    return "0,0,0";
                }
            }
            set
            {
                writeUiConfig("FontColor", value);
            }
        }

        public bool AutoCenter
        {
            get
            {
                try
                {
                    return bool.Parse(getUiConfig("AutoCenter"));
                }
                catch
                {
                    return false;
                }
            }
            set
            {
                writeUiConfig("AutoCenter", value.ToString());
            }
        }
        public bool TopMost
        {
            get
            {
                try
                {
                    return bool.Parse(getUiConfig("TopMost"));
                }
                catch
                {
                    return true;
                }
            }
            set
            {
                writeUiConfig("TopMost", value.ToString());
            }
        }

        public double Opacity
        {
            get
            {
                try
                {
                    return double.Parse(getUiConfig("Opacity"));
                }
                catch
                {
                    return 50;
                }
            }
            set
            {
                writeUiConfig("Opacity", value.ToString());
            }
        }

        public string BackgroundImage
        {
            get
            {
                try
                {
                    return getUiConfig("BackgroundImage");
                }
                catch
                {
                    return "1.jpg";
                }
            }
            set
            {
                writeUiConfig("BackgroundImage", value);
            }
        }
        #endregion
    }
}
